home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************************/
- /* */
- /* YTARCHIVE */
- /* Copyright ©1997 by Dick Whiting */
- /* */
- /*----------------------------------------------------------------------------*/
- /* This script requires YAMTOOLS for it to work. If you don't have YAMTOOLS */
- /* you can get it on Aminet in directory comm/mail. This script allows you */
- /* to archive all selected mail to a folder. This is only really useful from */
- /* the mail list of a SEARCH. Otherwise, use YAM's normal capabilities. */
- /* */
- /*----------------------------------------------------------------------------*/
- /* */
- /* Standard Disclaimer: I wrote it, it works for me, I don't guarantee */
- /* that it will do anything productive for anyone else, etc. etc. ;-) */
- /* */
- /*HOWEVER, if you DO find a use for it: I homeschool my kids and they */
- /*would love a postcard from where EVER you live. */
- /* */
- /*Instant GEOGRAPHY lesson;) */
- /* */
- /* */
- /*POSTCARDS: Dick Whiting */
- /* 28590 S. Beavercreek Rd. */
- /* Mulino, Oregon 97042 */
- /* USA */
- /* */
- /*----------------------------------------------------------------------------*/
- /* */
- /* Address Bug Reports or Comments to: */
- /* Dick Whiting <dwhiting@europa.com> */
- /* 28 February 1997 */
- /* */
- /******************************************************************************/
- /*
- $VER: 1.0 Copyright ©1997 by Dick Whiting
- $AUTHOR: Dick Whiting
- $DESCRIPTION: Archiver for use with YAMTOOLS
- */
-
- options results
- options failat 21
-
- targarch=''
- targanum=''
-
- parse arg targarch ',' targanum
-
- /**************************************************************************/
- /* Initialize Variables */
- /**************************************************************************/
- Call MUIvars /* go define vars for MUI use */
- Call YTvars /* various values used in YT */
- Call Helpvars /* pointers into HELP guide */
- Call Localize /* vars for localizing strings*/
- Call Builtvars /* built using previous values*/
-
- Address YAMTOOLS
-
- Call CheckYam
-
- Select
- when targarch='' then do
- Call CheckMailList
- Call ArchWindow
- Call DisplayArchs
- end
- otherwise do
- Call ProcessArchs
- end
- end
-
-
- exit
-
- /**************************************************************************/
- /* Check that there is some mail to process */
- /**************************************************************************/
- CheckMailList:
-
- list ID MLST ATTRS MUIA_List_Entries
- mcnt=result
- if mcnt=0 then do
- errmsg=_text._nomail
- Call ErrorMsg
- end
-
- Return
-
- /**************************************************************************/
- /* Display list of Archives */
- /**************************************************************************/
- DisplayArchs:
-
- list ID ALST ATTRS MUIA_List_Entries
- acnt=result
-
- do i=3 to acnt-1
- list ID ALST POS i
- aline=result
- if aline='' then break
- parse var aline arch ',' size ',' file ',' anum ',' rest
- liststr=arch','anum
- list ID ARCHF INSERT POS MUIV_List_Insert_Bottom STRING liststr
- end
-
- Return
-
- /**************************************************************************/
- /* Process Archivals */
- /**************************************************************************/
- ProcessArchs:
-
- if targanum < 3 then do
- errmsg=bo||targarch||' '||np||_text._badtarg
- Call ErrorMsg
- end
-
- window ID YTARC close
-
- infotitle=_title._info
- infotext=np||_text._inmail
- infobuttons=_text._squit1||comma||_text._squit2||comma||_text._squit3
- showbusy=TRUE
-
- Call InfoWindow
-
- list ID MLST ATTRS MUIA_List_Entries
- mcnt=result
-
- archlist.=missing
- archlist.0=0
- Updlist.=missing
- Updlist.0=0
- acnt=0
-
- do i=0 to mcnt-1
- list ID MLST
- mline=result
- if mline='' then break
- parse var mline arch ',' from ',' subj ',' mfor ',' mnum ',' anum ',' file
- acnt=acnt+1
- anum=right(anum,6,'0')
- mnum=right(mnum,6,'0')
- Archlist.0=acnt
- Archlist.acnt=anum mnum file subj
- archlist.0=acnt
- radio ID SQUIT
- if result~=_text._squit1 then leave
- end
- Updlist.0=Archlist.0
-
- if acnt=0 then do
- errmsg=_text._nomail
- Call ErrorMsg
- end
-
- if show('L','rexxtricks.library') then do /* use tricks library */
- call QSORT(archlist) /* sort by name, line number */
- end
- else do /* use QuickSort format */
- call QSORT(1, archlist.0, archlist) /* sort by name, number */
- end
-
- do i=archlist.0 to 1 by -1 /* process in reverse order */
- anum=word(Archlist.i,1)
- anum=strip(anum,'L','0')
- if anum='' then anum=0
- mnum=word(Archlist.i,2)
- mnum=strip(mnum,'L','0')
- if mnum='' then mnum=0
- file=word(Archlist.i,3)
- subj=subword(Archlist.i,4)
- Updlist.i=anum
- Updlist.i.1=mnum
- Updlist.i.1.1=file
- Updlist.i.1.1.1=subj
- if anum~=0 then do /* only INCOMING is valid */
- updlist.i.1.1.1.1=bo||_text._skipped
- iterate i
- end
- Address YAM 'setfolder 'anum /* goto folder */
- Address YAM 'setmail 'mnum /* set to mail */
- Address YAM "getmailinfo file" /* verify filename */
- xfile=result
- xlen=length(file)
- xfile=right(xfile,xlen)
- Address YAM "getmailinfo subject" /* verify subject */
- xsubj=result
- xsubj=translate(xsubj,' ',',')
- if file~=xfile | xsubj~=subj then do
- Updlist.i.1.1.1.1=bo||_text._error
- end
- else do
- Updlist.i.1.1.1.1=bo||_text._archived
- Address YAM "mailarchive " targanum
- end
- end
-
- do i=1 to Updlist.0
- do j=0 to mcnt-1
- list ID MLST POS j
- mline=result
- if mline='' then break
- parse var mline arch ',' from ',' subj ',' mfor ',' mnum ',' anum ',' file
- if Updlist.i=anum & Updlist.i.1=mnum then do
- arch=Updlist.i.1.1.1.1
- mline=arch||','||from||','||subj||','||mfor||','||mnum||','||anum||','||file
- list ID MLST POS j STRING mline
- iterate i
- end
- end
- end
-
- window ID YTINF CLOSE
-
- Return
-
- /**************************************************************************/
- /* Make sure YAM and YAMTOOLS are running. Show YAM. */
- /**************************************************************************/
- CheckYAM:
-
- if ~show('p','YAMTOOLS') then do
- errmsg=_text._noyt
- say errmsg
- exit
- end
-
- if ~show('p','YAM') then do
- errmsg=_text._noyam
- Call ErrorMsg
- exit
- end
-
- Address YAM 'show' /* uniconify YAM's screen */
-
- Address YAM 'info SCREEN' /* get YAM's screen */
- screen=result
- if screen='' then screen='Workbench'
-
- Return
-
- /******************************************************************************/
- /* Display ERROR message and EXIT. */
- /******************************************************************************/
- ErrorMsg:
-
- window ID YTINF CLOSE
-
- request ID ERRM GADGETS _text._ok errmsg
-
- exit
-
- Return
-
- /******************************************************************************/
- /* Display list of Archives for archive target selection. */
- /******************************************************************************/
- ArchWindow:
-
- window ID YTARC TITLE _title._main,
- COMMAND '"window ID YTARC close"' PORT YAMTOOLS,
- ATTRS MUIA_Window_PublicScreen screen
-
- group
- group
- text LABEL bc||_text._selfolder
- endgroup
- group
- list ID ARCHF COMMAND '"YTArchive.rexx %s"',
- HELP help.ARCHF NODE node.ARCHF,
- TITLE _title._archf,
- INSERT NODUP,
- ATTRS MUIA_List_Format '"BAR,P=\033r"'
- endgroup
- endgroup
-
- endwindow
-
- Return
-
- /******************************************************************************/
- /* Simple information/error message window. */
- /******************************************************************************/
- InfoWindow:
-
- window ID YTINF TITLE _title._info ATTRS MUIA_Window_PublicScreen screen,
- MUIA_Window_SizeGadget FALSE,
- MUIA_Window_DepthGadget FALSE
-
- group
- group
- text ID STEXT HELP help.STEXT NODE node.STEXT LABEL infotext
- endgroup
- if showbusy then do
- group
- object CLASS '"Busy.mcc"' ATTRS MUIA_VertWeight 25
- endgroup
- end
- if infobuttons ~='' then do
- group HORIZ
- group
- space HORIZ
- endgroup
- group
- radio ID SQUIT HELP help.SQUIT NODE node.SQUIT LABELS infobuttons
- endgroup
- group
- space HORIZ
- endgroup
- endgroup
- end
- else do
- group
- space HORIZ 100
- endgroup
- end
- endgroup
- endwindow
-
- Return
-
- /******************************************************************************/
- /* MUIREXX TAGS & VARIABLES */
- /******************************************************************************/
- Muivars:
-
- MUIA_List_Format = 0x80423c0a
- MUIA_List_Entries = 0x80421654
- MUIA_VertWeight = 0x804298d0
- MUIA_Window_DepthGadget = 0x80421923
- MUIA_Window_DragBar = 0x8042045d
- MUIA_Window_PublicScreen = 0x804278e4
- MUIA_Window_SizeGadget = 0x8042e33d
-
- TRUE=1
- FALSE=0
-
- MUIV_List_Insert_Active = -1
-
- Return
- /**************************************************************************/
- /* Various values used throughout the various routines */
- /**************************************************************************/
- YTvars:
-
- comma=','
- missing='.'
-
- bo='\033b' /* print control BOLD */
- bc='\033b\033c' /* print control BOLD CENTER */
- nc='\033n\033c' /* print control NORM CENTER */
- np='\033n' /* print control NORM */
- nl='\n' /* print control 1 NEW LINE */
- nl2='\n\n' /* print control 2 NEW LINES */
- ct='\033c' /* print control CENTER */
- lf='\033l' /* print control LEFT ALIGN */
- rt='\033r' /* print control RIGHT ALIGN */
-
- Return
-
- /**************************************************************************/
- /* Messages, text, etc. constructed using previously defined values */
- /**************************************************************************/
- Builtvars:
-
- _title._archf='"'||bo||_col._archf1||comma||bo||_col._archf2'"'
-
- Return
-
- /**************************************************************************/
- /* Pointers into the YamTools.guide documentation */
- /**************************************************************************/
- Helpvars:
-
- node.SQUIT='7.3.'
- node.STEXT='7.3.'
- node.ARCHF='7.3.'
-
- Return
-
- /**************************************************************************/
- /* Mui Gadgets, text, msgs, etc. used in YamTools */
- /**************************************************************************/
- Localize:
-
- /*********************************/
- /* Miscellaneous info strings */
- /*********************************/
- _title._main="""YTArchive""" /* main screen title */
- _title._info="""YTArchive Info""" /* default title on infomsg */
- _title._user="""YTArchive User Info""" /* title for user info screen */
-
- _text._ok="Ok" /* various OK buttons */
- _text._cancel="Cancel" /* LABEL for CANCEL button */
- _text._squit1="Continue" /* CONTINUE option on infowin */
- _text._squit2="Interrupt" /* INTERRUPT option on infowin*/
- _text._squit3="Abort" /* ABORT option on infowin */
-
- _col._archf1="Yam Folder Name" /* heading for ARCHF column 1 */
- _col._archf2="Number" /* heading for ARCHF column 2 */
-
- _text._selfolder="Select Target Folder For Archiving"
-
- _text._error="error" /* error on archiving mail */
- _text._skipped="skipped" /* skipped archiving mail */
- _text._archived="archived" /* indicate mail archived */
- _text._inmail="Only Incoming Mail will be processed ..."
-
-
- /*********************************/
- /* Various error conditions */
- /*********************************/
-
- _text._noyam="You need YAM running to use YTArchive" /* yam not running */
- _text._noyt="You need YAMTOOLS running to use YTArchive" /* no yamtools */
- _text._nomail="You need to SELECT mail to Archive"
- _text._badtarg=" is not a valid target for archiving"
-
- /**************************************************************************/
- /* Help Messages to display with MUI bubble facility. */
- /* */
- /* Format is simple: help.ID where ID is the id specified on the MUI */
- /* object statement. */
- /* Similar approach for accessing the .guide information using the NODE */
- /* option on the object statement. */
- /* */
- /**************************************************************************/
-
- help.SQUIT=""""""
- help.STEXT=""""""
- help.ARCHF=""""""
-
- Return
-
-
-
-